cmake_minimum_required(VERSION 3.10.2)

project("ndklearnproject")

# TODO 使用FMod库，完成声音特效
# TODO 1.导入库文件
include_directories("inc")

# TODO 定义allFile指定同级目录下的c/c++/头文件
file(GLOB allFile *.c *.h *.cpp *.hpp)

add_library(
        native-lib
        SHARED
        #        native-lib.cpp
        #        native-lib-imp.cpp
        # TODO   批量引用
        ${allFile}
)

# TODO 2.导入头文件对应的实现文件(.so库)
# CMAKE_SOURCE_DIR == CMakeLists.txt文件的路径
# CMAKE_ANDROID_ARCH_API  ==  当前设备的CPU架构
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_SOURCE_DIR}/../jniLibs/${CMAKE_ANDROID_ARCH_API}")


#set(native_root_dir ${CMAKE_SOURCE_DIR}/../)
#set(native_fmod_dir ${native_root_dir}/jniLibs/${CMAKE_ANDROID_ARCH_API})

#add_library(fmod SHARED IMPORTED)
#set_target_properties(fmod PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}/libfmod.so)
#find_library(
#        log-lib
#        log)

add_library(fmod SHARED IMPORTED)
set_target_properties(fmod PROPERTIES IMPORTED_LOCATION
        ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libfmod.so)

add_library(fmodL SHARED IMPORTED)
set_target_properties(fmodL PROPERTIES IMPORTED_LOCATION
        ${CMAKE_SOURCE_DIR}/../jniLibs/${ANDROID_ABI}/libfmodL.so)

target_link_libraries(
        native-lib
        log
#        ${log-lib}
        fmod
        fmodL
)